package com.fz.us.oa.core.entity.com;

import com.fz.us.admin.company.entity.BaseFlowEntity;
import com.fz.us.admin.company.entity.User;
import com.fz.us.admin.dict.entity.DictItem;
import com.fz.us.oa.core.entity.common.FileManage;

import javax.persistence.*;
import java.util.Date;
import java.util.List;
import java.util.Set;

/**
 * 业务实体类 - 收文登记表
 * ============================================================================
 * 版权所有 2017 。
 *
 * @author henryxu
 * @version 1.0 2017-02-08 。
 * ============================================================================
 */
@Entity
@Table(name="ec_infile")
public class Infile extends BaseFlowEntity {

    private static final long serialVersionUID = 4089426467879517506L;
    /**
     * 收文类别
     */
    private DictItem dictItem;
    /**
     * 收文编号
     */
    private String fileNo;
    /**
     * 收文标题 name
     */

    /**
     * 收文时间
     */
    private Date datReceived;
    /**
     * 处理期限
     */
    private Date datLine;

    /**
     * 传阅对象
     */
    private Set<User> viewers;

    /**
     * 正文附件
     */
    private List<FileManage> file;
    /**
     * 提交日期
     */
    private Date dateApply;
    /**
     * 文档状态数值
     */
    private int numStatus;
    /**
     * 文档状态文字
     */
    private String txtStatus;
    /**
     * 表单名称
     */
    private String form;

    @Column(nullable=false, columnDefinition = "varchar(50) default '收文登记表'")
    public String getForm() {
        return form;
    }

    public void setForm(String form) {
        this.form = form;
    }

    @ManyToOne(fetch = FetchType.LAZY)
    public DictItem getDictItem() {
        return dictItem;
    }

    public void setDictItem(DictItem dictItem) {
        this.dictItem = dictItem;
    }

    public String getFileNo() {
        return fileNo;
    }

    public void setFileNo(String fileNo) {
        this.fileNo = fileNo;
    }

    public Date getDatReceived() {
        return datReceived;
    }

    public void setDatReceived(Date datReceived) {
        this.datReceived = datReceived;
    }

    public Date getDatLine() {
        return datLine;
    }

    public void setDatLine(Date datLine) {
        this.datLine = datLine;
    }

    @ManyToMany(fetch = FetchType.LAZY)
    @OrderBy("pinYinHead asc")
    public Set<User> getViewers() {
        return viewers;
    }

    public void setViewers(Set<User> viewers) {
        this.viewers = viewers;
    }

    @ManyToMany(fetch = FetchType.LAZY)
    @JoinTable(name = "ec_infile_file", joinColumns = @JoinColumn(name="id"),inverseJoinColumns = @JoinColumn(name="fileId"))
    public List<FileManage> getFile() {
        return file;
    }

    public void setFile(List<FileManage> file) {
        this.file = file;
    }

    public Date getDateApply() {
        return dateApply;
    }

    public void setDateApply(Date dateApply) {
        this.dateApply = dateApply;
    }

    public int getNumStatus() {
        return numStatus;
    }

    public void setNumStatus(int numStatus) {
        this.numStatus = numStatus;
    }

    public String getTxtStatus() {
        return txtStatus;
    }

    public void setTxtStatus(String txtStatus) {
        this.txtStatus = txtStatus;
    }
}
